home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
lang_c
/
13h_kit
/
win.doc
< prev
next >
Wrap
Text File
|
1991-07-04
|
5KB
|
112 lines
>>>WIN.DOC
A. Copyright Information
Images.Hpp and Images.Cpp along with this document file are copyright
1991 by the Gamers Programming Workshop, GAMERS forum, Compuserve (GO GAMERS,
section 11). The code and related document are free for use, distribution,
and modification, provided the following conditions are met:
1. no commercial use of this source code or documents is permitted.
2. no fee may be charged beyond disk duplication cost for any of this
material.
3. If the code is upgraded or modified a copy of the modification must
be uploaded to section 11 of the GAMERS forum on Compuserve. All
modifications must be documented and the author's name included in
the source code header block, and the subsequent file package must
include all the original doc files as well as any additions. If you
modify or add functions please update the function list below.
B. Description
The win class as declared in IMAGES.HPP provides a simple means of creating
window areas on a mode 13h screen. The class allocates memory for, and saves
it's own background, so multiple windows can be created on top of one and
other, and each will restore the pre-existing background when it is deleted
or goes out of scope. Windows can be created in any size, and with any back-
ground color (including a bitmap), with or without a border of any color and
width, and with or without a shadow of any color and width.
The declaration of the class is shown below:
class win {
public:
char status; // 1 if window opened successfully
win(int tlx, int tly, int xwid, int ywid, char *bmap,
char brdrwid, char shdwwid, char bgrnd, char border);
char installed(){return(status);} // returns the status value
~win();
private:
char far *backgrnd; // pointer to background bitmap
int origX; // top left x coord of the window
int origY; // top left y coord of the window
int xsize; // window x dimension in pixels
int ysize; // window y dimension in pixels
char bdrwid; // border width, 0 if no border
char shdwid; // shadow width, 0 if no shadow
char shdwon; // 1 if shadow is on, 0 if not
char b_grnd; // window background color
char brdr; // border color, ignored if bdrwid=0;
};
C. Function interface
*****************************************************************************
win(int tlx, int tly, int xwid, int ywid, char *bmap,
char brdrwid, char shdwwid, char bgrnd, char border);
The constructor creates and displays the window. The following values are
passed:
tlx - top left x coord for window location
tly - top left y coord for window location
xwid - width of window in pixels in x dimension
ywid - depth of window in lines (pixels) in y dimension
*bmap - pointer to window bitmap (NULL if none)
brdrwid - width of colored border around window, 0 if none
shdwwid - width of window drop shadow, 0 if none
bgrnd - window background color (N/A if bmap != NULL)
border - border color (N/A if brdrwid == 0)
If bmap != NULL the window background when displayed will consist of the
rectangular bitmap pointed to by bmap. The bitmap is assumed to be the same
size as the window area, and the byte pointed to by bmap is assumed to be
the leftmost pizel of the first line of the image. If bmap == NULL then the
window will be created using a background of bgrnd color. Shadow drops down
and to the right. This is not selectable in the current methods, but methods
to change it could be added easily.
A window is created by declaring an instance, as follows:
win info(10,10,150,75,NULL,0,4,9,0);
or
win *info
info = new win(10,10,150,75,NULL,0,4,9,0);
Both of these methods creat a window at 10,10, 150 pixles wide by 75 lines
deep, with no border, a 4 pixel wide shadow, and a light blue background.
Immediately after declaring the instance you should check win.status for
any error during construction. It will contain one of the error constants
defined in IMAGES.HPP.
*****************************************************************************
~win()
The destructor closes the window, frees memory, and restores the background.
In the examples above the window would either close when the info instance
went out of scope, or when it was explicitly deleted.
*****************************************************************************
D. Support
Support for this tool will be provided as and where possible through mess-
ages posted to 76605,2346 in the Game Design section (sec. 11) of the Gamers
Forum on Compuserve. Sorry, no telephone support is possible.